package com.yxhl.zoume.domain.interactor.usercenter;

import com.yxhl.zoume.data.http.repository.usercenter.UserCenterRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.feedback.FeedbackParam;
import com.yxhl.zoume.data.http.rest.response.feedback.FeedbackResponse;
import com.yxhl.zoume.domain.DomainConstants;
import com.yxhl.zoume.domain.interactor.base.UseCase;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * 项目名称：Ferrari
 * Created by menggod on 16/11/22 .
 */

public class FeedbackUseCase extends UseCase<FeedbackResponse> {

    private UserCenterRepository repository;

    @Inject
    public FeedbackUseCase(@Named(DomainConstants.UI_THREAD) Scheduler uiThread,
                           @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
                           UserCenterRepository repository) {
        super(uiThread, executorThread);
        this.repository = repository;
    }

    @Override
    protected Observable<FeedbackResponse> buildObservable(RequestParamImpl param) {
        return repository.commitFeedback((FeedbackParam) param)
                .observeOn(uiThread)
                .subscribeOn(executorThread);
    }
}
